package com.chenjt.netty.eleven_bytebuf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
 * 注释：初体验
 *
 * @author chenjt
 * @date 2024/9/4 9:38
 */
public class SimpleTest {


    public static void main(String[] args) {

        ByteBuf buffer = Unpooled.buffer(10);

        for (int i = 0; i < 10; i++) {
            buffer.writeByte(i);
        }

        for (int i = 0; i < buffer.capacity(); i++) {
            // getByte 不会改变 readIndex
            System.out.println(buffer.getByte(i));
        }

        for (int i = 0; i < buffer.capacity(); i++) {
            // readByte 会改变 readIndex
            System.out.println(buffer.readByte());
        }


    }

}
